1. Field of the Invention
The present invention relates to a system, method, and program for caching data in a storage controller.
2. Description of the Related Art
High end storage controllers, such as the International Business Machines Corporation (IBM) Enterprise Storage Server** manage Input/Output (I/O) requests from networked hosts to one or more storage devices, such as a direct access storage device (DASD), Redundant Array of Independent Disks (RAID Array), and Just a Bunch of Disks (JBOD). Storage controllers include one or more host bus adaptor (HBA) cards to communicate with one or more hosts over a network and adaptors to communicate with the storage devices. The storage controllers also include a cache memory and often further include a non-volatile storage device (NVS), which may be comprised of a battery backed-up random access memory. In a Fast Write operation, the storage controller writes data updates to both the cache and NVS. The NVS is used to provide an extra copy of the data update in the event that the copy of the update in cache is lost as a result of a system failure. The storage controller returns a write complete message to the host that initiated the update request upon completing the write to both the cache and NVS, but before the data is actually written to the storage device. The cached data is then subsequently destaged to the target storage device. Once destaged to disk, the update copy in the cache and NVS may be removed. Typically, the NVS has a substantially smaller storage space than the cache memory.
**Enterprise Storage Server and IBM are trademarks of International Business Machines Corporation. 
In implementations where there are multiple storage devices connected to the storage controller, such as multiple ranks of Redundant Arrays of Inexpensive disks (RAID), the cache and NVS unit of the storage controller may store updates intended for the multiple storage devices. In the prior art, in the event that the NVS is substantially filled with updates for one target storage device and that target storage device fails, then complete status cannot be returned for writes directed toward the surviving storage devices if the NVS is filled with the data from the failed storage device. Complete status is not returned unless the update is copied to both cache and the NVS. Moreover, even in cases where the storage device whose updates dominate the NVS does not fail, if the storage device dominating NVS is processing I/Os at a slow rate, then other processes submitting I/Os to other devices are delayed to the rate that updates are destaged to the slower, dominating storage device. Destage operations to the dominating storage device may be running at a slow rate if one or more disk drives in the storage device are being rebuilt as a result of a failed drive or if the updates to the dominating storage device in NVS comprise mostly random (non-sequential) updates. Random updates take longer to destage because they have longer disk access times and, in a RAID environment, require constant parity recalculations for each random update.
For these reasons, there is a need in the art to provide techniques for managing write operations to improve cache performance.
Provided is a method, system, and program for caching updates to one target storage device in a first and second memories, wherein the target storage device is one of a plurality of storage devices. A determination is made of an allocation of available space in the second memory to the storage devices that applies throughout an entire session of operation during which updates are received. Throughout the entire session, when an update to one target storage device is received, a determination is made as to whether adding the update to the second memory will exceed the allocation of available space for the target storage device in the second memory. One copy of the update is written to the second memory if adding the update to the second memory will not exceed the allocation of available space for the target storage device.
Further provided is a method, system, and program for caching updates to one target storage device in a first and second memories, wherein the target storage device is one of a plurality of storage devices. A determination is made of an allocation of available space in the second memory to the storage devices, wherein a total of the allocation of the available space to all the storage devices exceeds one hundred percent of the available space in the second memory. An update to one target storage device is received and then a determination is made as to whether adding the update to the second memory will exceed the allocation of available space for the target storage device in the second memory. One copy of the update is written to the second memory if adding the update to the second memory will not exceed the allocation of available space for the target storage device.
In further implementations, the determination of the allocation of space in the second memory allocates a percentage of NVS to each storage device that is greater than a total available storage space in the NVS divided by a number of the plurality of storage devices.
In further implementations, the target storage device may be comprised of multiple storage units.
In yet further implementations the target storage device comprises a RAID device, wherein data is written in stripe units across the multiple storage units when writing data to the target storage device. In such case, a determination is made as to whether the update is a sequential update that is part of a sequential access to the target storage device. Before receiving enough sequential updates to the target storage device to fill one stripe unit, an indication is made that the sequential updates are not ready to destage to the target device. After receiving enough sequential updates to fill one stripe unit in the target storage device, an indication is made that the sequential updates are ready to destage to the target device by writing the sequential updates to one stripe unit in the target storage device.
Still further, applying the update to the second memory is deferred if an amount of storage space in the second memory used by updates to the target storage device after the update is applied would exceed the allocation of space for the target storage device.
In implementations where applying the update is deferred, upon performing a destage of one update in the second memory to one target storage device, the destaged update is marked for removal from the second memory and a request is made for resubmittal of one deferred update to the target storage device if the amount of space used by updates for the target storage device in the second memory is less than the allocation of space in the second memory for the target storage device.
The described implementations provide a technique for ensuring that a portion of the second memory or non-volatile memory may is allocated to each storage device to avoid the situation where the failure or processing delays of one storage device prevents updates to other storage devices from being cached in the second memory.